home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 051-075 / scopedisk55 / dirk2 / window.c < prev   
C/C++ Source or Header  |  1995-03-18  |  2KB  |  73 lines

  1.  
  2. /***************************************************************************
  3.     1/89
  4.  
  5.         DIRK v2.0 -- Tune workbench colors to system performance
  6.  
  7.         Copyright (C) 1989 by Daniel Elbaum
  8.  
  9.         This software is freely redistributable provided that:
  10.         the four files which comprise it (dirk, dirk.doc, dirk.h,
  11.         adjust.c, main.c, sys, window.c) remain intact; all
  12.         copyright notices contained in any of the aforementioned
  13.         files remain intact; and no fee beyond reasonable remuneration
  14.         for collation and distribution be charged for use and/or
  15.         distribution.
  16.  
  17. ***************************************************************************/
  18.  
  19.  
  20. #include "dirk.h"
  21.  
  22. /*
  23.     Just give me a window and don't make me
  24.     put endless initializations into main()
  25.     or global space, okay?
  26. */
  27.  
  28. /*
  29.     sp arg is more for symmetry than for anything else.
  30. */
  31.  
  32. struct Window *
  33. getwin(sp)
  34. struct Screen *sp;
  35. {
  36.     struct NewWindow nw;
  37.     struct Window *wp;
  38.  
  39.     memset(&nw, 0, sizeof(nw));
  40.     nw.LeftEdge = (sp->Width/2)-(WINWD/2);
  41.     nw.TopEdge = WINTOP;
  42.     nw.Width = WINWD;
  43.     nw.Height = WINHT1;
  44.     nw.DetailPen = sp->DetailPen;
  45.     nw.BlockPen = sp->BlockPen;
  46.     nw.Flags = WINFLAGS;
  47.     nw.IDCMPFlags = WINIFLAGS;
  48.     nw.Title=WINNAME;
  49.     nw.Type=WBENCHSCREEN;
  50.     nw.MinHeight=WINHT1;
  51.     nw.MaxHeight=WINHT1+WINHT2;
  52.     if (!(wp = OpenWindow(&nw))) {
  53.         return((struct Window *)NULL);
  54.     }
  55.     else return(wp);
  56. }
  57.  
  58. void
  59. redowin(wp, oldstatus)
  60. struct Window *wp;
  61. {
  62.     int d2bot;
  63.  
  64.     if (oldstatus==W_OPEN) SizeWindow(wp, 0, -(WINHT2-WINHT1));
  65.     else {
  66.         d2bot=(wp->WScreen->Height-wp->TopEdge)&0xFFFF;
  67.         if (d2bot<WINHT2)
  68.             MoveWindow(wp, 0, -(WINHT2-d2bot));
  69.         SizeWindow(wp, 0, WINHT2-WINHT1);
  70.     }
  71. }
  72.  
  73.